<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/headcss.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>平台首页</title>
	<script type="text/javascript" src="${path}/assets/js/jquery-2.0.3.min.js"></script>
	<script type="text/javascript">		
			$(function(){
				var tree; 
				$.ajax({
	                type: "POST",//方法类型
	                dataType: "json",//预期服务器返回的数据类型
	                url: "${path}/resource/treeListIndex" ,//url
	                success: function (data) {   
	                	tree = data;
	                	reload(tree); 
	                },
	                error : function() {
	                    alert(" 菜单初始化失败！ ");
	                }
	            });
				
			});
		  function setIframeHeight(iframe) {
				if (iframe) {
					var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
					if (iframeWin.document.body) {
						iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
					}
				}
			};
			window.onload = function () {
				setIframeHeight(document.getElementById('mainframe'));
			};
			function openUrl(url,id){
				if(url.length!=0){
					$('#mainframe').attr("src","${path}"+url);
					setPosition(id);
				}
				
			}
			function reload(tree){
				 
				$(tree).each(function(index,element){
					 
				     if(element.pId==0){
				    	 $('#menu_ul').append('<li  ><a href="#"  class="dropdown-toggle" onclick= openUrl("'+element.url+'","'+element.id+'") ><i class="icon-leaf"></i>'+ element.name+' <b class="arrow icon-angle-down"></b></a><ul id="'+ element.id+'" name='+element.name+'   parentid='+element.pId+' class="submenu"></ul></li>');
				     }else{
				    	 if(findElem(tree,"pId",element.id) ==-1){
				    	 	$('#'+element.pId).append('<li id='+ element.id+' parentid='+element.pId+' name='+element.name+'  ><a href="#" onclick= openUrl("'+element.url+'","'+element.id+'") ><i class="icon-leaf"></i>'+ element.name+'</a></li>');
				    	 }else{
				    		 $('#'+element.pId).append('<li><a  class="dropdown-toggle" href="#" onclick= openUrl("'+element.url+'","'+element.id+'") ><i class="icon-leaf"></i>'+ element.name+'<b class="arrow icon-angle-down"></b></a><ul id="'+ element.id+'" name='+element.name+' parentid='+element.pId+' class="submenu"></ul></li>');
				    	 }
				    	
				     }
				  });
			}
			function findElem(arrayToSearch,attr,val){
			    for (var i=0;i<arrayToSearch.length;i++){
			        if(arrayToSearch[i][attr]==val){
			            return i;
			        }
			    }
			    return -1;
			}
			var setPosition = function(id){  
			  	  if(id!="-1"){
			  	  	var menu ="";	   
			  	    var name = $("#"+id).attr("name");
			  	    $("li").each(function(index){
			  	    	$(this).removeClass("active");
			  	    });
			  	    $("#"+id).addClass("active");
			  	    menu=name;
			  	    var parentid = $("#"+id).attr("parentid");
			  	    while($("#"+parentid).length>0){
			  	        menu = $("#"+parentid).attr("name") +">>"+menu;
			  	        parentid = $("#"+parentid).attr("parentid");
			  	    }
					$("#msg").text(menu);
					document.getElementById("tabname").value=name;
			  	  }else{
					$("#msg").text("首页");
			 	 }
			}
		</script>
</head>
<body>  
	<div class="navbar navbar-default" id="navbar">
			<script type="text/javascript">
				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
			</script>

			<div class="navbar-container" id="navbar-container">
				<div class="navbar-header pull-left">
					<a href="#" class="navbar-brand">
						<small>
							<i class="icon-leaf"></i>
							SsmDemo,管理系统...
						</small>
					</a><!-- /.brand -->
				</div><!-- /.navbar-header -->

				<div class="navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<li class="grey">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="icon-tasks"></i>
								<span class="badge badge-grey">4</span>
							</a>

							<ul class="pull-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<i class="icon-ok"></i>
									还有4个任务完成
								</li>

								<li>
									<a href="#">
										查看任务详情
										<i class="icon-arrow-right"></i>
									</a>
								</li>
							</ul>
						</li>

						<li class="purple">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="icon-bell-alt icon-animated-bell"></i>
								<span class="badge badge-important">8</span>
							</a>

							<ul class="pull-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<i class="icon-warning-sign"></i>
									8条通知
								</li>

								<li>
									<a href="#">
										<div class="clearfix">
											<span class="pull-left">
												<i class="btn btn-xs no-hover btn-pink icon-comment"></i>
												新闻评论
											</span>
											<span class="pull-right badge badge-info">+12</span>
										</div>
									</a>
								</li>

								<li>
									<a href="#">
										<i class="btn btn-xs btn-primary icon-user"></i>
										切换为编辑登录..
									</a>
								</li>

							

								<li>
									<a href="#">
										查看所有通知
										<i class="icon-arrow-right"></i>
									</a>
								</li>
							</ul>
						</li>

						<li class="green">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="icon-envelope icon-animated-vertical"></i>
								<span class="badge badge-success">5</span>
							</a>

							<ul class="pull-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<i class="icon-envelope-alt"></i>
									5条消息
								</li>

								<li>
									<a href="#">
										<img src="assets/avatars/avatar4.png" class="msg-photo" alt="Bob's Avatar" />
										<span class="msg-body">
											<span class="msg-title">
												<span class="blue">Bob:</span>
												到底是不是英文 ...
											</span>

											<span class="msg-time">
												<i class="icon-time"></i>
												<span>下午3:15</span>
											</span>
										</span>
									</a>
								</li>

								<li>
									<a href="inbox.html">
										查看所有消息
										<i class="icon-arrow-right"></i>
									</a>
								</li>
							</ul>
						</li>

						<li class="light-blue">
							<a data-toggle="dropdown" href="#" class="dropdown-toggle">
								<img class="nav-user-photo" src="assets/avatars/user.jpg" alt="Jason's Photo" />
								<span class="user-info">
									<small>欢迎光临,</small>
									Jason
								</span>

								<i class="icon-caret-down"></i>
							</a>

							<ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<li>
									<a href="#">
										<i class="icon-cog"></i>
										设置
									</a>
								</li>

								<li>
									<a href="#">
										<i class="icon-user"></i>
										个人资料
									</a>
								</li>

								<li class="divider"></li>

								<li>
									<a href="#">
										<i class="icon-off"></i>
										退出
									</a>
								</li>
							</ul>
						</li>
					</ul><!-- /.ace-nav -->
				</div><!-- /.navbar-header -->
			</div><!-- /.container -->
		</div>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<div class="sidebar" id="sidebar">
					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
					</script>

					<div class="sidebar-shortcuts" id="sidebar-shortcuts">
						<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
							<button class="btn btn-success">
								<i class="icon-signal"></i>
							</button>

							<button class="btn btn-info">
								<i class="icon-pencil"></i>
							</button>

							<button class="btn btn-warning">
								<i class="icon-group"></i>
							</button>

							<button class="btn btn-danger">
								<i class="icon-cogs"></i>
							</button>
						</div>

						<div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
							<span class="btn btn-success"></span>

							<span class="btn btn-info"></span>

							<span class="btn btn-warning"></span>

							<span class="btn btn-danger"></span>
						</div>
					</div><!-- #sidebar-shortcuts -->

					<ul class="nav nav-list" id="menu_ul" >
						<li class="active">
							<a href="index.html">
								<i class="icon-dashboard"></i>
								<span class="menu-text"> 首页</span>
							</a>
						</li>
					</ul><!-- /.nav-list -->

					<div class="sidebar-collapse" id="sidebar-collapse">
						<i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
					</div>

					<script type="text/javascript">
						try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
					</script>
				</div>

				<div class="main-content">
				    <div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a id="msg">首页</a>
								<input id="tabname" type="hidden" value="">
							</li>
						
						</ul><!-- .breadcrumb -->
					</div>
					<div class="page-content">
						<div class="row">
							<div class="col-xs-12">
								<iframe frameborder="0" scrolling="no"  width="100%" id="mainframe" onload="setIframeHeight(this);" src="${path}/sysuser/list" >  </iframe>
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->
			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->


		<!--[if IE]>
			<script src="/assets/js/jquery-1.10.2.min.js"></script>
		<![endif]-->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='${path}/assets/js/jquery-2.0.3.min.js'>"+"<"+"script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
			<script type="text/javascript">
			 window.jQuery || document.write("<script src='${path}/assets/js/jquery-1.10.2.min.js'>"+"<"+"script>");
			</script>
		<![endif]-->	
		<!--[if lte IE 8]>
		  <script src="${path}/assets/js/excanvas.min.js"></script>
		<![endif]-->
		<script type="text/javascript" src="${path}/assets/js/jquery.mobile.custom.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/typeahead-bs2.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/jquery-ui-1.10.3.custom.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/jquery.ui.touch-punch.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/jquery.slimscroll.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/jquery.sparkline.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/flot/jquery.flot.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/flot/jquery.flot.pie.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/flot/jquery.flot.resize.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/ace-elements.min.js"></script>
		<script type="text/javascript" src="${path}/assets/js/ace.min.js"></script>
		 

		<!-- inline scripts related to this page -->

	

</body>
</html>